package com.deltapunkt.proxy.main;

import java.io.IOException;
import java.util.concurrent.Executor;
import java.util.concurrent.Executors;

import com.deltapunkt.proxy.AsyncServer;
import com.deltapunkt.proxy.TaskScheduler;
import com.deltapunkt.proxy.factory.ProxyFactory;

public class ClientSideMain {

//	public static final String TARGET_ADDR = "86.19.207.21";
//	public static final int TARGET_PORT = 32767;
	
	private static void startForwardProxy(ForwardPair fp) throws IOException {
		Executor exec = Executors.newSingleThreadExecutor(); // page 119
		TaskScheduler scheduler = new TaskScheduler(10);
		ProxyFactory proxyFactory = ProxyFactory.forClientAuthPortForward(fp.getDstAddr());
		AsyncServer server = new AsyncServer(scheduler, proxyFactory, fp.getSrcAddr());

		exec.execute(server);
	}

	public static void main(String[] args) throws IOException {
		ForwardPair fp = new ForwardPair("", 8433, "127.0.0.1", 32767);
		startForwardProxy(fp);
	}
}
